<template>
  <div> 
    <!-- 预约服务 -->
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">

  <el-form-item label="预约人姓名" prop="name">
  <el-input  v-model="ruleForm.name"></el-input>
  </el-form-item>

  <el-form-item label="联系方式" prop="password">
    <el-input v-model="ruleForm.password"></el-input>
  </el-form-item>
  <el-form-item label="详细地址" prop="make">
    <el-input v-model="ruleForm.make"></el-input>
  </el-form-item>
  <el-form-item label="服务套餐" prop="region">
    <el-select v-model="ruleForm.region" placeholder="请选择套餐">
      <el-option label="套餐一" value="shanghai"></el-option>
      <el-option label="套餐二" value="beijing"></el-option>
      <el-option label="套餐三" value="beijing"></el-option>
    </el-select>
  </el-form-item>
 
  <el-form-item label="服务性质" prop="type">
    <el-checkbox-group v-model="ruleForm.type">
      <el-checkbox label="一战式服务" name="type"></el-checkbox>
      <el-checkbox label="遗体接运服务" name="type"></el-checkbox>
      <el-checkbox label="火化服务" name="type"></el-checkbox>
  
    </el-checkbox-group>
  </el-form-item>

  <el-form-item label="服务时间" required>
    <el-col :span="11">
      <el-form-item prop="date1">
        <el-date-picker type="date" placeholder="选择日期" v-model="ruleForm.date1" style="width: 100%;"></el-date-picker>
      </el-form-item>
    </el-col>
    <el-col class="line" :span="2">-</el-col>
    <el-col :span="11">
      <el-form-item prop="date2">
        <el-time-picker type="fixed-time" placeholder="选择时间" v-model="ruleForm.date2" style="width: 100%;"></el-time-picker>
      </el-form-item>
    </el-col>
  </el-form-item>
  <el-form-item label="留言" prop="desc">
    <el-input type="textarea" v-model="ruleForm.desc"></el-input>
  </el-form-item>
  <el-form-item>

    <el-button type="primary" @click="submitForm('ruleForm')"  >确认</el-button>
    <el-button @click="resetForm('ruleForm')">拒绝</el-button>
  </el-form-item>
  <br>
</el-form>
<div>


<p style="font-size: small; text-align: right; ">一条龙24小时葬丧服务———————————————殡葬、殡礼、太平间——————————————主办单位:中软国际——————————————热线服务:0289245</p>

</div>
<hr >
    </div>
</template>

<script>
export default {
  data() {
      return {
        ruleForm: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        rules: {
          name: [
            { required: true, message: '请输入姓名', trigger: 'blur' },
            { min: 2, max: 9, message: '长度在 2到 9个字符', trigger: 'blur' }
          ],
          password:[
          { required: true, message: '请输入电话', trigger: 'blur' },
          
          ],
          make:[
          { required: true, message: '地址', trigger: 'blur' },
          ],
          region: [
            { required: true, message: '请选择套餐', trigger: 'change' }
          ],
          date1: [
            { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
          ],
          date2: [
            { type: 'date', required: true, message: '请选择时间', trigger: 'change' }
          ],
          type: [
            { type: 'array', required: true, message: '请至少选择一项服务', trigger: 'change' }
          ],
          resource: [
            { required: true, message: '请选择套餐', trigger: 'change' }
          ],
          desc: [
            { required: true, message: '备注', trigger: 'blur' }
          ]
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            this.$message({
              message:"预约成功",
              type:'success'
            })
          }  

           else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
}}

</script>

<style lang="less" scoped>

</style>